<html>
<head>
    <title>Windows Live</title>
    <script src="Scripts/constants.js"></script>
    <script src="https://js.live.net/v5.0/wl.js"></script>
</head>
<body>
    <div id="signin">
    </div>
    <label id="info">
    </label>
    <script>
        WL.Event.subscribe("auth.login", onLogin);
        WL.init({
            client_id: APP_CLIENT_ID,
            redirect_uri: REDIRECT_URL,
            scope: "wl.signin,wl.share",
            response_type: "token"
        });
        WL.ui({
            name: "signin",
            element: "signin"
        });
        function onLogin(session)
        {
            if (!session.error)
            {
                WL.api(
                {
                    path: "me/share",
                    method: "POST",
                    message: "Microsoft is stupid in that their Live Connect API does not provide a way to get message!!!!"
                },
                function (response)
                {
                    if (!response.error)
                    {
                        strGreeting = "Hi, " + response.message + "!"
                        document.getElementById("info").innerHTML = strGreeting;
                    }
                });
            }
            else
            {
                document.getElementById("info").innerText =
                        "Error signing in: " + session.error_description;
            }
        }
    </script>
</body>
</html>
